package day09.CatTest1;

public class test1 {
    public static void main(String[] args) {
        //构造方法
        //修饰词 类名(参数列表){
        //      构造方法体 }
        //作用：给对象的成员变量初始化
        //不写构造方法 则系统自动匹配无参构造
        //Cat ci = new Cat();
        //有构造方法，必须传参
        Cat c1= new Cat("Hello Kitty",5,"pink",6.0);
        System.out.println(c1.name);
        System.out.println(c1.age);
        System.out.println(c1.color);
        System.out.println(c1.weight);

    }
}
class Cat{
    String name;
    int age;
    String color;
    double weight;

    //定义构造方法
    public Cat(String name1,int age1,String color1,double weight1){
        //给成员变量赋值
        name = name1;
        age = age1;
        color = color1;
        weight = weight1;
    }
}
